package com.googlecode.animator.data.viewports
{
	import com.googlecode.animator.data.IValueObject;
	import com.googlecode.animator.data.ValueObject;
	
	public class ViewportVO extends ValueObject
	{
		public static const TYPE:String = "viewport";

		public var viewportID:String;
		
		public var currentCamera:String;
		
		override public function clone(src:* = null):IValueObject
		{
			var clone:IValueObject = new ViewportVO();
			
			(clone as ViewportVO).currentCamera = this.currentCamera;
			(clone as ViewportVO).viewportID = this.viewportID;
			
			return (clone as ViewportVO);
		}
		
		override public function toXML(src:XML = null):XML
		{
			var xml:XML = super.toXML(new XML(<{TYPE} id={viewportID}></{TYPE}>));
			
			xml.appendChild(<currentCamera>{this.currentCamera}</currentCamera>);

			return xml;
		}
		
		override public function fromXML(src:XML):void
		{
			super.fromXML(src);
			
			this.currentCamera = src.currentCamera;
			this.viewportID = src.@id;
	
		}		
	}
}